<?php
	require 'Session.php';
	Session::start();
	include('config.php');
	if(Session::get("cobach_admin")){
		//$user_array = $_SESSION["cobach_admin"];
?>
<html>
	<head>
    	<meta charset="utf-8" />
        <title>SCI Cobach Campeche</title>
    <link href="../styles/principal.css" rel="stylesheet" type="text/css">
     <link href="../styles/main.css" rel="stylesheet" type="text/css">
    <link href="../styles/dropdown.css" rel="stylesheet" type="text/css">
	</head>
<body class="container">
       <nav>
        	<img src="../resourses/logo_cobach.jpg" height="40">
        	<ul>
       	     <li class="active"><a href="#">Inicio</a></li>
             <li><a class="drop" href="consultas.php">Consultas</a>
             	<div class="dropdown">
            	<form method="post" action="consultas_admin.php">
                	<select name="planteles">
                    	<option value="" selected>Todos los planteles</option>
<?php
	$result = mysql_query('SELECT * FROM plantel');
	if(isset($_POST['planteles'])){
		while($row=mysql_fetch_array($result)){
			if($row['id']==$_POST['planteles']){
			echo '<option value="'.$row["id"].'" selected>'.$row["nombre_plantel"].'</option>';
			}else{
				echo '<option value="'.$row["id"].'">'.$row["nombre_plantel"].'</option>';
			}
		}
		if($row['id']==$_POST['equipos']){
			echo '<option value="'.$row["id"].'" selected>'.$row["nombre_plantel"].'</option>';
			}else{
				}
	}else{
		while($row=mysql_fetch_array($result)){
			echo '<option value="'.$row["id"].'">'.$row["nombre_plantel"].'</option>';
		}
	}
?>
                    </select>
                	<select name="equipos">
                    	<option value="0" selected>Todos los equipos</option>
<?php
	$result = mysql_query('SELECT * FROM tipo_equipo');
	if(isset($_POST['equipos'])){
		while($row=mysql_fetch_array($result)){
			if($row['id']==$_POST['equipos']){
			echo '<option value="'.$row["id"].'" selected>'.$row["nombre"].'</option>';
			}else{
				echo '<option value="'.$row["id"].'">'.$row["nombre"].'</option>';
			}
		}
		if($row['id']==$_POST['equipos']){
			echo '<option value="'.$row["id"].'" selected>'.$row["nombre"].'</option>';
			}else{
				}
	}else{
		while($row=mysql_fetch_array($result)){
			echo '<option value="'.$row["id"].'">'.$row["nombre"].'</option>';
		}
	}
?>
                    </select>
                    <button type="submit">Buscar</button>
                </form>
                </div>
             </li>
             <li><a href="ver_reportes_admin.php">Reportes</a></li>               
          </ul>
    </nav>
		<div id="content">
            <div id="inicio">
            	<div id="info">
<?php /*?>                    <p><?php echo ''.$user_array['nombre_plantel'].' - '.$user_array['localidad'].'' ?></p>
                    <p><?php echo ''.$user_array['nombre'].' '.$user_array['apellido_paterno'].' '.$user_array['apellido_materno'].'' ?></p>
<?php */?>						  
						  <p><?php echo ''.Session::get("cobach_admin","nombre_plantel").' - '.Session::get("cobach_admin","localidad").'' ?></p>
                    <p><?php echo ''.Session::get("cobach_admin","nombre").' '.Session::get("cobach_admin","apellido_paterno").' '.Session::get("cobach_admin","apellido_materno").'' ?></p>
                </div>
            </div>
        </div>
        <footer>
        	<p>Sistema de Control Infomatico | Cobach Campeche</p>
<?php /*?>            <p><?php echo ''.$user_array['nombre_plantel'].' - '.$user_array['localidad'].' | '.$user_array['nombre'].' '.$user_array['apellido_paterno'].' '.$user_array['apellido_materno'].'' ?> (Administrador) | <a href="logout.php">Salir</a></p>
<?php */?>		
		
				<p><?php echo ''.Session::get("cobach_admin","nombre_plantel").' - '.Session::get("cobach_admin","localidad").' | '.Session::get("cobach_admin","nombre").' '.Session::get("cobach_admin","apellido_paterno").' '.Session::get("cobach_admin","apellido_materno").'' ?> (Administrador) | <a href="logout.php">Salir</a></p>
        </footer>
</body>
</html>
<?php
	}else{
?>
	<script language="javascript">
		location.href="../login.php";
	</script>
<?php
	}
?>